'use strict'

/** @type {import('sequelize-cli').Migration} */
module.exports = {
  async up(queryInterface, Sequelize) {
    const { TEXT, INTEGER, DATE } = Sequelize
    await queryInterface.createTable('banners', {
      id: {
        type: INTEGER(20).UNSIGNED,
        autoIncrement: true,
        primaryKey: true,
        comment: '主键id'
      },
      resouse_id: {
        type: INTEGER(20).UNSIGNED,
        allowNull: false,
        comment: '资源id'
      },
      title: {
        type: TEXT,
        allowNull: false,
        comment: '主标题'
      },
      subtitle: {
        type: TEXT,
        allowNull: true,
        comment: '副标题'
      },
      gitee_url: {
        type: TEXT,
        allowNull: true,
        comment: 'gitee地址'
      },
      created_at: DATE,
      updated_at: DATE
    })
  },

  async down(queryInterface) {
    queryInterface.dropTable('banners')
  }
}
